package eu.szemraj.utils {

    public class BooleanUtil {

        /**
         * converts given string representation to boolean value. It doesn't work like casting string to Boolean
         * <b>true</b> is returned only if string contains "1" or "true", otherwise <b>false</b> is returned.
         */
        public static function fromString( booleanStringValue:String, defaultValue:Boolean = false  ):Boolean {
   		
            if( booleanStringValue == null ) return defaultValue;
            if( booleanStringValue.toLowerCase( ) == "true" ) return true;
            if( booleanStringValue.toLowerCase( ) == "1" ) return true;
            return defaultValue;
        }
    }
}
